package com.sky.mapper;

import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderMapper {

    void insert(Orders orders);


    @Select("select * from orders where status = #{deliveryInProgress} and order_time < #{time}")
    List<Orders> getByStatusAndOrderTimeLT(Integer deliveryInProgress, LocalDateTime time);

    @Update("update orders set status = #{status} where id = #{id}")
    void update(Orders order);
}
